package com.imooc.dataobject;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.imooc.enums.OrderStatusEnum;
import com.imooc.enums.PayStatusEnum;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;


import javax.persistence.*;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
//@DynamicUpdate
//@EntityListeners(AuditingEntityListener.class)
@Entity
@Data
@DynamicUpdate
public class OrderMaster {
    /**
     * 订单id
     */
    @Id
    private String orderId;
    //买家名字
    private String buyerName;
    //买家手机号
    private String buyerPhone;
    private String buyerAddress;
    private String buyerOpenid;
    private BigDecimal orderAmount;

    /**订单状态， 默认为0 新下单。*/
    private Integer orderStatus = OrderStatusEnum.NEW.getCode();
    /**支付状态， 默认为0未支付*/
    private Integer payStatus = PayStatusEnum.WAIT.getCode();

//    @Column(name = "create_time")
    private Date createTime;
//
    //@Column(name = "update_time")
    private Date updateTime;
    //创建时间
//    @CreationTimestamp
//    @JsonFormat(pattern="yyyy-MM-dd HH:mm")
//    private Date createTime;
//
//    //更新时间
//    @UpdateTimestamp
//    private Date updateTime;

}
